package com.example.cruds.controller;

import com.example.cruds.common.Result;
import com.example.cruds.utils.OssUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/file")
public class UploadController {

    @Autowired
    private OssUtils ossUtils;
    @PostMapping("/uploads")
    public Result uploads(MultipartFile image) throws IOException {
        String uploadoss = ossUtils.uploadoss(image);
        return Result.success(uploadoss);
    }
}
